﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/MasterPage.Master" AutoEventWireup="true" CodeBehind="ManagePlaces.aspx.cs" Inherits="DrivingCRM.Views.Private.CRM.ManagePlaces" %>
<asp:Content ID="Content1" ContentPlaceHolderID="title" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="banniere" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="nav" runat="server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="contenu" runat="server">
    <h2>Gestion des Lieux</h2>
    <asp:ListView ID="LV_Places" runat="server" DataKeyNames="IdPlace" 
        DataSourceID="DS_Places" OnItemCanceling="LV_Places_ItemCancelling" OnItemInserting="LV_Places_ItemInserting"
        OnItemUpdating="LV_Places_ItemUpdating">
        <AlternatingItemTemplate>
            <td runat="server" style="background-color:#FFF8DC;">
                <table class="Table_ItemList">
                    <tr>
                        <td>Nom:</td>
                        <td><asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
                            </td>
                    </tr>
                    <tr>
                        <td>Type:</td>
                        <td><asp:Label ID="TypeLabel" runat="server" Text='<%# Eval("PlaceType.Type") %>' /></td>
                    </tr>
                    <tr>
                        <td>Agence:</td>
                        <td><asp:Label ID="AgencyLabel" runat="server" Text='<%# Eval("Agency.Name") %>' /></td>
                    </tr>
                    <tr>
                        <td>Adresse:</td>
                        <td><asp:Label ID="AddressLabel" runat="server" Text='<%# Eval("Address.CompleteAddress") %>' /></td>
                    </tr>
                    <tr>
                        <td><asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="Supprimer" /></td>
                        <td><asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Modifier" /></td>
                    </tr>
                </table>
            </td>
        </AlternatingItemTemplate>
        <EditItemTemplate>
            <td runat="server" style="background-color:#008A8C;color: #FFFFFF;">
                <table class="Table_ItemList">
                    <tr>
                        <td>Nom:</td>
                        <td> <asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>' /></td>
                    </tr>
                    <tr>
                        <td>Type:</td>
                        <td><asp:DropDownList ID="DDL_PlaceType" runat="server" 
                                DataSourceID="DS_TypePlaces" DataTextField="Type" 
                                DataValueField="IdPlaceType" />
                            <asp:EntityDataSource ID="DS_TypePlaces" runat="server" 
                                ConnectionString="name=Model_DrivingCRMContainer" 
                                DefaultContainerName="Model_DrivingCRMContainer" EnableFlattening="False" 
                                EntitySetName="PlaceTypeSet" EntityTypeFilter="PlaceType">
                            </asp:EntityDataSource>
                        </td>
                    </tr>
                    <tr>
                        <td>Agence:</td>
                        <td><asp:DropDownList ID="DDL_PlaceAgency" runat="server" 
                                DataSourceID="DS_Agency" DataTextField="Name" 
                                DataValueField="IdAgency" />
                            <asp:EntityDataSource ID="DS_Agency" runat="server" 
                                ConnectionString="name=Model_DrivingCRMContainer" 
                                DefaultContainerName="Model_DrivingCRMContainer" EntitySetName="AgencySet" 
                                EntityTypeFilter="Agency">
                            </asp:EntityDataSource>
                        </td>
                    </tr>
                    <tr>
                        <td>Adresse:</td>
                        <td><asp:DropDownList ID="DDL_PlaceAddress" runat="server" 
                                DataSourceID="DS_Addresses" 
                                DataTextField="CompleteAddress" DataValueField="IdAdress" />
                            <asp:EntityDataSource ID="DS_Addresses" runat="server" 
                                ConnectionString="name=Model_DrivingCRMContainer" 
                                DefaultContainerName="Model_DrivingCRMContainer" EntitySetName="AddressSet" 
                                EntityTypeFilter="Address">
                            </asp:EntityDataSource>
                        </td>
                    </tr>
                    <tr>
                        <td><asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="Mettre à jour" /></td>
                        <td><asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Annuler" /></td>
                    </tr>
                </table>
            </td>
        </EditItemTemplate>
        <EmptyDataTemplate>
            <table runat="server" 
                style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
                <tr>
                    <td>
                        <h2>Aucun lieu en base</h2></td>
                    </tr>
                    <tr>
                        <td><asp:Button ID="B_AddPlace" runat="server" Text="Ajouter un lieu" OnClick="B_AddPlace_Click" /></td>
                    </tr>
            </table>
        </EmptyDataTemplate>
        <EmptyItemTemplate>
<td runat="server" />
        </EmptyItemTemplate>
        <GroupTemplate>
            <tr ID="itemPlaceholderContainer" runat="server">
                <td ID="itemPlaceholder" runat="server">
                </td>
            </tr>
        </GroupTemplate>
        <InsertItemTemplate>
            <td runat="server">
                <table class="Table_ItemList">
                    <tr>
                        <td>Nom:</td>
                        <td><asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>' /></td>
                    </tr>
                    <tr>
                        <td>Type:</td>
                        <td><asp:DropDownList ID="DDL_PlaceType" runat="server" 
                                DataSourceID="DS_TypePlaces" DataTextField="Type" 
                                DataValueField="IdPlaceType" />
                            <asp:EntityDataSource ID="DS_TypePlaces" runat="server" 
                                ConnectionString="name=Model_DrivingCRMContainer" 
                                DefaultContainerName="Model_DrivingCRMContainer" EnableFlattening="False" 
                                EntitySetName="PlaceTypeSet" EntityTypeFilter="PlaceType">
                            </asp:EntityDataSource></td>
                    </tr>
                    <tr>
                        <td>Agence:</td>
                        <td><asp:DropDownList ID="DDL_PlaceAgency" runat="server" 
                                DataSourceID="DS_Agency" DataTextField="Name" 
                                DataValueField="IdAgency" />
                            <asp:EntityDataSource ID="DS_Agency" runat="server" 
                                ConnectionString="name=Model_DrivingCRMContainer" 
                                DefaultContainerName="Model_DrivingCRMContainer" EntitySetName="AgencySet" 
                                EntityTypeFilter="Agency">
                            </asp:EntityDataSource></td>
                    </tr>
                    <tr>
                        <td>Adresse:</td>
                        <td><asp:DropDownList ID="DDL_PlaceAddress" runat="server" 
                                DataSourceID="DS_Addresses" 
                                DataTextField='CompleteAddress' DataValueField="IdAdress" />
                            <asp:EntityDataSource ID="DS_Addresses" runat="server" 
                                ConnectionString="name=Model_DrivingCRMContainer" 
                                DefaultContainerName="Model_DrivingCRMContainer" EntitySetName="AddressSet" 
                                EntityTypeFilter="Address">
                            </asp:EntityDataSource></td>
                    </tr>
                    <tr>
                        <td><asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="Insérer" /></td>
                        <td><asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Annuler" /></td>
                    </tr>
                </table>
            </td>
        </InsertItemTemplate>
        <ItemTemplate>
            <td runat="server" style="background-color:#DCDCDC;color: #000000;">
                <table class="Table_ItemList">
                    <tr>
                        <td>Nom:</td>
                        <td><asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' /></td>
                    </tr>
                    <tr>
                        <td>Type:</td>
                        <td><asp:Label ID="TypeLabel" runat="server" Text='<%# Eval("PlaceType.Type") %>' /></td>
                    </tr>
                    <tr>
                        <td>Agence:</td>
                        <td><asp:Label ID="AgencyLabel" runat="server" Text='<%# Eval("Agency.Name") %>' /></td>
                    </tr>
                    <tr>
                        <td>Adresse:</td>
                        <td><asp:Label ID="AddressLabel" runat="server" Text='<%# Eval("Address.CompleteAddress") %>' /></td>
                    </tr>
                    <tr>
                        <td><asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="Supprimer" /></td>
                        <td><asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Modifier" /></td>
                    </tr>
                </table>
            </td>
        </ItemTemplate>
        <LayoutTemplate>
            <table runat="server">
                <tr runat="server">
                    <td runat="server">
                        <table ID="groupPlaceholderContainer" runat="server" border="1" 
                            style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">
                            <tr ID="groupPlaceholder" runat="server">
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr runat="server">
                    <td runat="server"><asp:Button ID="B_AddPlace" runat="server" Text="Ajouter un lieu" OnClick="B_AddPlace_Click" /> </td>
                </tr>
                <tr runat="server">
                    <td runat="server" 
                        style="text-align: center;background-color: #CCCCCC;font-family: Verdana, Arial, Helvetica, sans-serif;color: #000000;">
                        <asp:DataPager ID="DataPager1" runat="server" PageSize="12">
                            <Fields>
                                <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
                                    ShowNextPageButton="False" ShowPreviousPageButton="False" PreviousPageText="Précédent" FirstPageText="Première page" />
                                <asp:NumericPagerField />
                                <asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" 
                                    ShowNextPageButton="False" ShowPreviousPageButton="False" NextPageText="Suivant" LastPageText="Dernière page" />
                            </Fields>
                        </asp:DataPager>
                    </td>
                </tr>
            </table>
        </LayoutTemplate>
        <SelectedItemTemplate>
        </SelectedItemTemplate>
    </asp:ListView>
    <asp:EntityDataSource ID="DS_Places" runat="server" 
        ConnectionString="name=Model_DrivingCRMContainer" 
        DefaultContainerName="Model_DrivingCRMContainer" EnableDelete="True" 
        EnableInsert="True" EnableUpdate="True" EntitySetName="PlaceSet" 
        EntityTypeFilter="Place" Include="PlaceType,Agency,Address">
    </asp:EntityDataSource>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="footer" runat="server">
</asp:Content>
